module dgl.content.ContentManager;

import tango.util.collection.HashMap;

import dgl.graphics.Texture2D;
import dgl.graphics.Model;

static class ContentManager
{
	private static HashMap!( char[], Object ) m_resources;
	
	public static this()
	{
		m_resources = new HashMap!( char[], Object );
	}
	
	public static T load(T)( char[] assetName )
	{
		if( m_resources.containsKey( assetName ) )
		{
			return cast(T)m_resources[assetName];
		}
		else
		{
			T content = T.loadFromFile( assetName );
			if( content !is null )
			{
				m_resources.add( assetName, content );
				return content;
			}
		}
		return null;
	}
}